public class Solution668 {
    public int findKthNumber(int m, int n, int k) {
        int l=1,r=Integer.MAX_VALUE;
        int ans=-1;
        while (l<=r){
            int mid=l+(r-l)/2;
            int t=0;
            for (int i=1;i<=m;i++){
                t+=Math.min(mid/i,n);
            }
            if (t<k){
                l=mid+1;
            }else {
                ans=mid;
                r=mid-1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution668().findKthNumber(3,3,5));
    }
}
